﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using Yuebon.Commons;
using Yuebon.Commons.Helpers;
using Yuebon.Security.IServices;
using Yuebon.Security.Models;

namespace Yuebon.WebApp.Controllers
{
    public class HomeController : BusinessController<User,IUserService>
    {
        public HomeController(IUserService _iService) : base(_iService)
        {
        }

        public override IActionResult Index()
        {
            if (CurrentUser==null)
            {
                return Redirect("/");
            }
            ViewData["Account"] = CurrentUser.Account;
            ViewData["RealName"] = CurrentUser.RealName;
            ViewData["UserName"] = string.Format("{0}({1})", CurrentUser.RealName, CurrentUser.Account);
            ViewData["SoftName"] = Configs.GetConfigurationValue("AppSetting", "SoftName");
            ViewData["Title"] = ViewData["SoftName"];
            ViewData["Copyriht"] = string.Format("<strong>Copyright &copy; 2017-{0} <a href=\"https://www.yuebon.com\">Yuebon Tech</a>.</strong> All rights reserved.", DateTime.Now.Year);
            return View(CurrentUser);
        }

    }
}
